from  quantradecenter.qexchangedatebase.dclibzh.Exchangesetting.dcpsetting import dcexchange
from quantradecenter.qexchangedatebase.dclibzh.Exchangesetting.urlinfosetting import urlinfo
from quantradecenter.qexchangedatebase.dclibzh.Exchangetools.dctools import getAPIkey
import requests
from quantradecenter.qexchangedatebase.dclibzh.Exchangesetting.gpvarsetting import gpvarsetting
from quantradecenter.qexchangedatebase.dclibzh.Exchangetools.dctools import exchangetopandasdf
from quantradecenter.qexchangedatebase.dclibzh.Exchange.huobiexchangedata import huobipro as hbp




class huobipro(hbp):

    def __init__(self,api_key=gpvarsetting.gpvarsettingdata['AccessKeyId'],secret_key=gpvarsetting.gpvarsettingdata[ 'SecretKey']):
        #api
        super(huobipro,self).__init__(api_key=api_key,secret_key=secret_key)
        print('进入程序')


    # # api验证需要sort
    def apiKeySecretnoneerror(self):
        super(huobipro,self).apiKeySecretnoneerror()

    # # 获取所有交易对：
    # # 此接口返回所有火币全球站支持的交易对
    def getAllsymbols(self,exchangedata=None):
        return super(huobipro,self).getAllsymbols(exchangedata=exchangedata)

#     # 获取所有币种：
#     # 此接口返回所有火币全球站支持的币种
    def getAllcurrency(self,exchangedata=None):
        return super(huobipro,self).getAllcurrency(exchangedata=exchangedata)


#     # 获取当前系统时间：
#     # 此接口返回当前的系统时间，时间是调整为北京时间的时间戳，单位毫秒。
    def getTimestamp(self,exchangedata=None):
        return super(huobipro,self).getTimestamp(exchangedata=exchangedata)
#
#     # K 线数据（蜡烛图）：
#     # 此接口返回历史K线数据。
#     #参数详解：period是每根蜡烛的时间区间（1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year）
#            # symbol是交易对(btcusdt)，size是 K 线数据条数，可以不加此参数，默认150
#     @staticmethod
    def getKline(self,period,symbol,size=r'150',exchangedata=None):
        return super(huobipro, self).getKline(period,symbol,size=size,exchangedata=exchangedata)
#
#     # 聚合行情（Ticker）
#     # 此接口获取ticker信息同时提供最近24小时的交易聚合信息
#     #参数详解：symbol是交易对(btcusdt)
#     @staticmethod
    def getTicker(self,symbol,exchangedata=None):
        return super(huobipro, self).getTicker(symbol,exchangedata=exchangedata)


#     # 所有交易对的最新 Tickers
#     # 获得所有交易对的 tickers，数据取值时间区间为24小时滚动。
#     @staticmethod
    def getAllTicker(self,exchangedata=None):
        return super(huobipro, self).getAllTicker(exchangedata=exchangedata)


#     # 市场深度数据
#     # 此接口返回指定交易对的当前市场深度数据。
#     # 参数详解：symbol是交易对(btcusdt),type是深度的价格聚合度（step0，step1，step2，step3，step4，step5），depth是返回深度的数量,默认是20
#     @staticmethod
    def getMarketdepth(self,symbol,type,depth='20',exchangedata=None):
        return super(huobipro, self).getMarketdepth(symbol,type,depth=depth,exchangedata=exchangedata)

#
#     # 最近市场成交记录
#     # 此接口返回指定交易对最新的一个交易记录
#     # 参数详解：symbol是交易对(btcusdt),
#     @staticmethod
    def getNewtrade(self,symbol,exchangedata=None):
        return super(huobipro, self).getNewtrade(symbol,exchangedata=exchangedata)

#     # 获得近期交易记录
#     # 此接口返回指定交易对近期的所有交易记录
#     # 参数详解：symbol是交易对(btcusdt),
#     @staticmethod
    def getAlltrade(self,symbol,size=1,exchangedata=None):
        return super(huobipro, self).getAlltrade(symbol,size=size,exchangedata=exchangedata)

#     # 最近24小时行情数据
#     # 此接口返回最近24小时的行情数据汇总
#     # 参数详解：symbol是交易对(btcusdt),
#     @staticmethod
    def getAlldetail(self,symbol,exchangedata=None):
        return super(huobipro, self).getAlldetail(symbol,exchangedata=exchangedata)

#
#
#     # 获取用户当前手续费率(需要登陆后操作）：
#     # Api用户查询交易对费率，一次限制最多查10个交易对，子用户的费率和母用户保持一致
    def getFeerate(self,symbolrate='btcusdt',exchangedata=None):
        return super(huobipro, self).getFeerate(symbolrate=symbolrate,exchangedata=exchangedata)


#     # 账户信息(需要登陆后操作）
#     # 查询当前用户的所有账户 ID account-id 及其相关信息(需要登陆后操作）
    def getAllaccounts(self,exchangedata=None):
        return super(huobipro, self).getAllaccounts(exchangedata=exchangedata)


#
#     # 账户余额(需要登陆后操作）
#     # 查询指定账户的余额，支持以下账户：spot：现货账户， margin：杠杆账户，otc：OTC 账户，point：点卡账户
    def getAccountsBalance(self,accountid='9538734',exchangedata=None):
        return super(huobipro, self).getAccountsBalance(accountid=accountid,exchangedata=exchangedata)

#
#     # 稳定币兑换汇率((需要登陆后操作）
#     # 查询稳定币兑换汇率
    def getExchangerate(self,exchangedata=None):
        return super(huobipro, self).getExchangerate(exchangedata=exchangedata)


#     # 虚拟币提现(需要登陆后操作)
#     # API Key 权限：提币
    def postCreateWithdraw(self, address, amount, currency, addrtag=None, fee=None,chain=None,exchangedata=None ):
        return super(huobipro, self).postCreateWithdraw(address, amount, currency, addrtag=addrtag, fee=fee,chain=chain,exchangedata=exchangedata)

#
#     #此功能暂时不开通
    def postCancelWithdraw(self, withdrawid,exchangedata=None):
        return super(huobipro, self).postCancelWithdraw(withdrawid,exchangedata=exchangedata)


#
#     # 充提记录(需要登陆后操作)
#     # 查询充提记录
    def getDepositwithdraw(self,type1='deposit',currency=None,hfrom=None,size=None,direct=None,exchangedata=None):
        return super(huobipro, self).getDepositwithdraw(type1='deposit',currency=None,hfrom=hfrom,size=size,direct=direct,exchangedata=exchangedata)

#
#
#     # 下单充提记录(需要登陆后操作)
#     # 发送一个新订单到火币以进行撮合。
    def postOrders(self,accountid,symbol,type1,amount,price=None,source='api',exchangedata=None):
        return super(huobipro, self).postOrders(accountid,symbol,type1,amount,price=price,source=source,exchangedata=exchangedata)

#
#
#     # 撤销订单
#     # 此接口发送一个撤销订单的请求。
    def postSubmmitcancel(self, orderid,exchangedata=None):
        return super(huobipro, self).postSubmmitcancel(orderid,exchangedata=exchangedata)


#
#     # 撤销订单（基于client order ID）(需要登陆后操作)
#     # 此接口发送一个撤销订单的请求。此接口只提交取消请求，实际取消结果需要通过订单状态，撮合状态等接口来确认。
    def postsubmitCancelClientOrder(self, clientorderid,exchangedata=None):
        return super(huobipro, self).postsubmitCancelClientOrder( clientorderid,exchangedata=exchangedata)


#
#
#      # 查询当前未成交订单(需要登陆后操作)
#      # 查询已提交但是仍未完全成交或未被撤销的订单。
    def getOpenOrders(self, accountid,symbol,side=None,size=None,exchangedata=None):
        return super(huobipro, self).getOpenOrders( accountid,symbol,side=side,size=size,exchangedata=exchangedata)

#
#
#     # 批量撤销订单(需要登陆后操作)
#     # 此接口发送批量撤销订单的请求。
    def postCancelOpenOrders(self, accountid,symbol=None,side=None,size=None,exchangedata=None):
        return super(huobipro, self).postCancelOpenOrders(accountid,symbol=symbol,side=side,size=size,exchangedata=exchangedata)

#
#     # 批量撤销订单 (需要登陆后操作)
#     # 此接口同时为多个订单（基于id）发送取消请求。
    def postBatchcancel(self, orderids,exchangedata=None):
        return super(huobipro, self).postBatchcancel( orderids,exchangedata=exchangedata)


#
#     # 查询订单详情(需要登陆后操作)
#     # 此接口返回指定订单的最新状态和详情
    def getOrdersinfo(self, orderid,exchangedata=None):
        return super(huobipro, self).getOrdersinfo(orderid,exchangedata=exchangedata)

#
#     # 查询订单详情（基于client order ID）(需要登陆后操作)
#     # 此接口返回指定订单的最新状态和详情。
    def getClientOrderinfo(self, clientOrderId,exchangedata=None):
        return super(huobipro, self).getClientOrderinfo( clientOrderId,exchangedata=exchangedata)


#     # 成交明细(需要登陆后操作)
#     # 此接口返回指定订单的成交明细
    def getMatchresults(self, orderid,exchangedata=None):
        return super(huobipro, self).getMatchresults(orderid,exchangedata=exchangedata)


#
#     # 搜索历史订单 (需要登陆后操作)
#     # 此接口基于搜索条件查询历史订单。
    def getHistoryorders(self,symbol,states,types1=None,startdate=None,enddate=None,hfrom=None,direct=None,size=None,exchangedata=None):
        return super(huobipro, self).getHistoryorders(symbol,states,types1=types1,startdate=startdate,enddate=enddate,hfrom=hfrom,direct=direct,size=size,exchangedata=exchangedata)


#     # 搜索最近48小时内历史订单(需要登陆后操作)
#     # 此接口基于搜索条件查询最近48小时内历史订单。
    def gethistory48hours(self, symbol=None, startdate=None, enddate=None, direct=None,
                         size=None,exchangedata=None):
        return super(huobipro, self).gethistory48hours( symbol=symbol, startdate=startdate, enddate=enddate, direct=direct,
                         size=size,exchangedata=exchangedata)

#
#     # 当前和历史成交(需要登陆后操作)
#     # 此接口基于搜索条件查询当前和历史成交记录
    def getHMatchresults(self,symbol,types1=None,startdate=None,enddate=None,hfrom=None,direct=None,size=None,exchangedata=None):
        return super(huobipro, self).getHMatchresults(symbol,types1=types1,startdate=startdate,enddate=enddate,hfrom=hfrom,direct=direct,size=size,exchangedata=exchangedata)


#
#     # 币币现货账户与合约账户划转(需要登陆后操作)
#     # 此接口用户币币现货账户与合约账户之间的资金划转。
#     # 从现货现货账户转至合约账户，类型为pro-to-futures; 从合约账户转至现货账户，类型为futures-to-pro
#     # 该接口的访问频次的限制为1分钟10次。
    def postAccounttransfer(self, currency,amount,type1,exchangedata=None):
        return super(huobipro, self).postAccounttransfer( currency,amount,type1,exchangedata=exchangedata)


#
#     # 资产划转(需要登陆后操作)
#     # 此接口用于现货账户与杠杆账户的资产互转从现货账户划转至杠杆账户 transfer-in，从杠杆账户划转至现货账户 transfer-out
    def postMargintransferin(self, symbol,currency,amount,exchangedata=None):
        return super(huobipro, self).postMargintransferin( symbol,currency,amount,exchangedata=exchangedata)

#
#
    def postMargintransferout(self, symbol,currency,amount,exchangedata=None):
        return super(huobipro, self).postMargintransferout( symbol,currency,amount,exchangedata=exchangedata)


#
#     # 申请借贷(需要登陆后操作)
#     # 此接口用于申请借贷.
    def postmarginorders(self, symbol, currency, amount,exchangedata=None):
        return super(huobipro, self).postmarginorders( symbol, currency, amount, exchangedata=exchangedata)

        #
#     # 归还借贷(需要登陆后操作)
#     # 此接口用于归还借贷.
#
    def postRepay(self, orderid,  amount,exchangedata=None):
        return super(huobipro, self). postRepay(orderid,  amount, exchangedata=exchangedata)

#
#     # 查询借贷订单(需要登陆后操作)
#     # 此接口基于指定搜索条件返回借贷订单。
    def getSearchorders(self,symbol,startdate=None,enddate=None,hfrom=None,direct=None,size=None,exchangedata=None):
        return super(huobipro, self). getSearchorders(symbol,startdate=startdate,enddate=enddate,hfrom=hfrom,direct=direct,size=size, exchangedata=exchangedata)

#     # 借贷账户详情
#         # 此接口返回借贷账户详情。
    def getMarginbalance(self,symbol=None,exchangedata=None):
        return super(huobipro, self).getMarginbalance(symbol=symbol, exchangedata=exchangedata)


#
# # 合约期货
#     # 合约市场行情接口
#     # 此接口返回合约信息。
#     @staticmethod
    def getContractinfo(self,exchangedata=None):
        return super(huobipro, self).getContractinfo(exchangedata=exchangedata)


#
#     # K 线数据（蜡烛图）：
#     # 此接口返回期货合约历史K线数据。
#     #参数详解：period是每根蜡烛的时间区间（1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year）
#            # symbol是交易对(btcusdt)，size是 K 线数据条数，可以不加此参数，默认150
#     @staticmethod
    def getMarketkline(self,period,symbol,size=r'150',exchangedata=None):
        return super(huobipro, self).getMarketkline(period,symbol,size=size,exchangedata=exchangedata)


#     # 期货账户详情
#     # 此接口返回期货账户详情。
#     # 参数详解：symbol是单个xrp
    def postContractaccountinfo(self,symbol,exchangedata=None):
        return super(huobipro, self).postContractaccountinfo(symbol,exchangedata=exchangedata)

    # 此接口用户持仓信息。
    # 参数详解：symbol是单个xrp
    def postContractpositioninfo(self,symbol,exchangedata=None):
        return super(huobipro, self).postContractpositioninfo(symbol,exchangedata=exchangedata)





    # 下单充提记录(需要登陆后操作)
    # 期货合约下单
    def postContractorders(self, symbol, contract_type, contract_code , volume,direction,offset,lever_rate,order_price_type,price=None,  exchangedata=None):
        return super(huobipro, self).postContractorders( symbol, contract_type, contract_code , volume,direction,offset,lever_rate,order_price_type,price=price ,exchangedata=exchangedata)

   # 撤销订单期货合约下单
    def postCancelcontractorders(self, symbol, order_id=None, client_order_id=None,exchangedata=None):
        return super(huobipro, self).postCancelcontractorders(symbol, order_id=order_id, client_order_id=client_order_id ,exchangedata=exchangedata)

    # 下单充提记录(需要登陆后操作)
    # 撤销所有订单
    def postALLcancelcontractorders(self, symbol, contract_code=None, contract_type=None,
                             exchangedata=None):
        return super(huobipro, self).postALLcancelcontractorders( symbol, contract_code=contract_code, contract_type=contract_type,
                             exchangedata=exchangedata)

    # 获取所有期货订单信息
    def postContractorderinfo(self, symbol, order_id=None, client_order_id=None,
                             exchangedata=None):

        return super(huobipro, self).postContractorderinfo(symbol, order_id=order_id, client_order_id=client_order_id ,exchangedata=exchangedata)

  # 闪电平单
    def postLightningcloseposition(self, symbol, contract_type, contract_code, volume, direction,
                       client_order_id=None, exchangedata=None):
        return super(huobipro, self).postLightningcloseposition(symbol, contract_type, contract_code, volume, direction,
                       client_order_id=client_order_id, exchangedata=exchangedata)

#
# if __name__ == '__main__':
#     huobipro=huobipro()
#     huobipro.apiKeySecretnoneerror()
    # 获取所有交易对：
    # # #返回的参数：里面按照api参数进行付值，如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getAllsymbols())
    # print(huobipro.getAllsymbols(exchangedata='data'))
    # # #
    # # 获取所有币种：
    # #返回的参数：里面按照api参数进行付值，如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getAllsymbols())
    # print(huobipro.getAllsymbols(exchangedata='data'))
    # #
    # # # 获取当前系统时间：
    # # #返回的参数：里面按照api参数进行付值，如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getTimestamp())
    # print(huobipro.getTimestamp(exchangedata='data'))
    # #
    # # # K 线数据（蜡烛图)
    # # #数详解：period是每根蜡烛的时间区间（1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year）
    # # # symbol是交易对(btcusdt)，size是 K 线数据条数，可以不加此参数，默认150
    # # #返回的参数：里面按照api参数进行付值，如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getKline('5min','btcusdt'))
    # print(huobipro.getKline('1min', 'btcusdt',size='2000',exchangedata='data'))
    # #
    #
    # # 聚合行情（Ticker）
    # # 此接口获取ticker信息同时提供最近24小时的交易聚合信息
    # #参数详解：symbol是交易对(btcusdt)如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getTicker('btcusdt'))
    # print(huobipro.getTicker('btcusdt',exchangedata='data'))
    #
    # # 所有交易对的最新 Tickers
    # # 获得所有交易对的 tickers，数据取值时间区间为24小时滚动。
    # #参数详解：symbol是交易对(btcusdt)如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getAllTicker())
    # print(huobipro.getAllTicker(exchangedata='data'))
    #
    # # 市场深度数据
    # # 此接口返回指定交易对的当前市场深度数据。如有exchangcedata='data'则返回的是panda格式
    # # 参数详解：symbol是交易对(btcusdt),type是深度的价格聚合度（step0，step1，step2，step3，step4，step5），depth是返回深度的数量,默认是20
    # print(huobipro.getMarketdepth('xrpusdt','2'))
    # print(huobipro.getMarketdepth('xrpusdt','2',exchangedata='data'))
    #
    # # 最近市场成交记录
    # # 此接口返回指定交易对最新的一个交易记录如有exchangcedata='data'则返回的是panda格式
    # # 参数详解：symbol是交易对(btcusdt),
    # print(huobipro.getNewtrade('xrpusdt'))
    # print(huobipro.getNewtrade('xrpusdt',exchangedata='data'))
    #
    #
    #
    # # 获得近期交易记录
    # # 此接口返回指定交易对近期的所有交易记录如有exchangcedata='data'则返回的是panda格式
    # # # 参数详解：symbol是交易对(btcusdt),
    # print(huobipro.getAlltrade('xrpusdt'))
    # print(huobipro.getAlltrade('xrpusdt',exchangedata='data'))
    #
    # # 最近24小时行情数据
    # # 此接口返回最近24小时的行情数据汇总如有exchangcedata='data'则返回的是panda格式
    # # 参数详解：symbol是交易对(btcusdt),
    # print(huobipro.getAlldetail('xrpusdt'))
    # print(huobipro.getAlldetail('xrpusdt',exchangedata='data'))

    # 获取用户当前手续费率(需要登陆后操作）：
    # Api用户查询交易对费率，一次限制最多查10个交易对，子用户的费率和母用户保持一致如有exchangcedata='data'则返回的是panda格式
    # print( huobipro.getFeerate(symbolrate='xrpusdt'))
    # print(huobipro.getFeerate(symbolrate='xrpusdt',exchangedata='data'))

    # 账户信息(需要登陆后操作）
    # 查询当前用户的所有账户 ID account-id 及其相关信息(需要登陆后操作）如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getAllaccounts())
    # print(huobipro.getAllaccounts(exchangedata='data'))


    # 账户余额(需要登陆后操作）
    # 查询指定账户的余额，支持以下账户：spot：现货账户， margin：杠杆账户，otc：OTC 账户，point：点卡账户如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getAccountsBalance(accountid='9547894'))
    # print(huobipro.getAccountsBalance(accountid='9547894',exchangedata='data'))

    # 稳定币兑换汇率((需要登陆后操作）
    # 查询稳定币兑换汇率如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getExchangerate())
    # print(huobipro.getExchangerate(exchangedata='data'))

    # 虚拟币提现(需要登陆后操作)
    # API Key 权限：提币则返回的如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.postCreateWithdraw(gpvarsetting.gpokex['xrpwithdraw'],'10','xrp',addrtag=gpvarsetting.gpokex['xrpbiaoqian']))
    # print(huobipro.postCreateWithdraw(gpvarsetting.gpokex['xrpwithdraw'],'10','xrp',addrtag=gpvarsetting.gpokex['xrpbiaoqian'],exchangedata='data'))

    # 充提记录(需要登陆后操作)
    # 查询充提记录如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getDepositwithdraw())
    # print(huobipro.getDepositwithdraw(exchangedata='data'))

    # 下单充提记录(需要登陆后操作)
    # 发送一个新订单到火币以进行撮合。如有exchangcedata='data'则返回的是panda格式
    # a=huobipro.postOrders('9538734','xrpusdt','buy-limit','6','0.2',exchangedata='data')
    # b=huobipro.postOrders('9538734','xrpusdt','buy-limit','6','0.2',exchangedata='data')

    # 撤销订单
    # 此接口发送一个撤销订单的请求。如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.postSubmmitcancel(a))
    # print(huobipro.postSubmmitcancel(b,exchangedata='data'))

    # 查询当前未成交订单(需要登陆后操作)
    # 查询已提交但是仍未完全成交或未被撤销的订单。如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getOpenOrders('9538734','xrpusdt'))
    # print(huobipro.getOpenOrders('9538734', 'xrpusdt',exchangedata='data'))

    # 批量撤销订单(需要登陆后操作)
    # 此接口发送批量撤销订单的请求。如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.postCancelOpenOrders('9538734'))
    # print(huobipro.postCancelOpenOrders('9538734',exchangedata='data'))


    # 下单充提记录(需要登陆后操作)
    # 发送一个新订单到火币以进行撮合。如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.postBatchcancel([a,b]))
    # print(huobipro.postBatchcancel([a, b],exchangedata='data'))


    # 查询订单详情(需要登陆后操作)
    # 此接口返回指定订单的最新状态和详情如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getOrdersinfo(a))
    # print(huobipro.getOrdersinfo(a,exchangedata='data'))


    # 成交明细(需要登陆后操作)
    # 此接口返回指定订单的成交明细如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getMatchresults(a))
    # print(huobipro.getMatchresults(b,exchangedata='data'))

    # 搜索历史订单 (需要登陆后操作)
    # 此接口基于搜索条件查询历史订单。如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getHistoryorders('xrpusdt','filled'))
    # print(huobipro.getHistoryorders('xrpusdt', 'filled',exchangedata='data'))


    # 搜索最近48小时内历史订单(需要登陆后操作)
    # 此接口基于搜索条件查询最近48小时内历史订单。如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.gethistory48hours())
    # print(huobipro.gethistory48hours(exchangedata='data'))


    # 当前和历史成交(需要登陆后操作)
    # 此接口基于搜索条件查询当前和历史成交记录,如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getHMatchresults('xrpusdt'))
    # print(huobipro.getHMatchresults('xrpusdt',exchangedata='data'))


    # 币币现货账户与合约账户划转(需要登陆后操作)
    # 此接口用户币币现货账户与合约账户之间的资金划转。
    # 从现货现货账户转至合约账户，类型为pro-to-futures; 从合约账户转至现货账户，类型为futures-to-pro
    # 该接口的访问频次的限制为1分钟10次。如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.postAccounttransfer('xrp',10.00, 'futures-to-pro'))
    # print(huobipro.postAccounttransfer('xrp',10.00,'pro-to-futures',exchangedata='data'))

    # 资产划转(需要登陆后操作)如有exchangcedata='data'则返回的是panda格式
    # 此接口用于现货账户与杠杆账户的资产互转从现货账户划转至杠杆账户 transfer-in，从杠杆账户划转至现货账户 transfer-out
    # print(huobipro.postMargintransferout('xrpusdt','xrp','3'))
    # print(huobipro.postMargintransferout('xrpusdt', 'xrp', '3',exchangedata='data'))
    # print(huobipro.postMargintransferin('xrpusdt','xrp','3'))
    # print(huobipro.postMargintransferin('xrpusdt','xrp','3',exchangedata='data'))

    # 申请借贷(需要登陆后操作)
    # 此接口用于申请借贷.如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.postmarginorders('xrpusdt','xrp','1'))
    # print(huobipro.postmarginorders('xrpusdt', 'xrp', '1',exchangedata='data'))

    # 归还借贷(需要登陆后操作)
    # 此接口用于归还借贷.如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.postRepay('32432','122'))


    # 查询借贷订单(需要登陆后操作)
    # 此接口基于指定搜索条件返回借贷订单。如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getSearchorders('xrpusdt'))
    # print(huobipro.getSearchorders('xrpusdt',exchangedata='data'))

    # 借贷账户详情
    # # 此接口返回借贷账户详情。如有exchangcedata='data'则返回的是panda格式
    # print(huobipro.getMarginbalance())
    # print(huobipro.getMarginbalance(exchangedata='data'))

# 合约期货
    # 合约市场行情接口
    # 此接口返回合约信息。
    # print(huobipro.getContractinfo())
    # print(huobipro.getContractinfo(exchangedata='data'))


    # 此接口返回合约指数。
    # print(huobipro.getContractindex('XRP'))
    # print(huobipro.getContractindex('XRP',exchangedata='data'))

    #此接口返回期货合约历史K线数据。
    # print(huobipro.getMarketkline(r'15min','XRP_CQ','500'))
    # print(huobipro.getMarketkline(r'15min', 'XRP_CQ', '500',exchangedata='data'))

    # 期货账户详情
    # 此接口返回期货账户详情。
    # 参数详解：symbol是单个xrp
    # print(huobipro.postContractaccountinfo('XRP'))
    # print(huobipro.postContractaccountinfo('XRP',exchangedata='data'))

    # def postContractorders(self, symbol, contract_type, contract_code ,client_order_id, volume,direction,offset,lever_rate,order_price_type,price=None, source='api', exchangedata=None):
    # print(huobipro.postContractorders('XRP', 'quarter', 'XRP191227',1, 'sell','open', 1, 'opponent',exchangedata='data'))